<?php
class UserCommentForm extends Zend_Form {
	
	private $user;
	private $advertisement;
	private $next;
	
	/**
	 * 
	 * @param $user
	 * @param $advertisement
	 */
	public function UserCommentForm($user, $advertisement, $next=null) {
		$this->user = $user;
		$this->advertisement = $advertisement;
		$this->next = $next;
		$this->__construct();
	}
	
	public function init() {
		$config = Zend_Registry::get("config");
		$this->setName("UserCommentForm");
		$this->setAction($config->baseurl."/user/add-comment");
		
		$element = new Zend_Form_Element_Hidden("next");
		$element->setValue($this->next);
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("user_id");
		$element->setValue($this->user->id);
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden("advertisement_id");
		$element->setValue($this->advertisement->id);
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Textarea("comment");
		$element->setLabel("Comment");
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Submit("Ok");
		$this->addElement($element);
	}
}
?>